package cn.bsb.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.bsb.pojo.BackendUser;


public interface backendUserMapper {
	@Select("select * from backend_user where user_code=#{userCode} and `password`=#{password}")
	public BackendUser findOne(@Param("userCode") String userCode,@Param("password") String password);
	
	@Select("select * from backend_user")
	public List<BackendUser> getList();
	
	@Select("select * from backend_user where `user_code` like concat ('%',#{userCode},'%')")
	public List<BackendUser> getName(@Param("userCode")String userCode);
	
	@Delete("delete from backend_user where id = #{id}")
	public int deleteUserById(@Param("id")Integer delId)throws Exception;
	
	@Insert("insert into backend_user (user_code,user_name,password,sex,email,mobile,address,creattime,pic,type) "
			+ "values (#{user_code},#{user_name},#{password},#{sex},#{email},#{mobile},#{address},#{creattime},#{pic},#{type})")
	public int add(BackendUser backendUser)throws Exception;
}